package com.sgcc.pda.hw;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * @创建者：闫亚锋 on 2018/2/1
 * @描述：
 * @版本：1.0
 * @修改人：jianiuqi
 * @修改时间：2020/07/14
 * @修改说明：中台版调用认证后处理逻辑对结果处理有细化增加msg字段
 * @修改版本：1.0.1
 */
public class ReturnResult implements Parcelable {

    /**
     * 成功失败的标志  0：成功  其他失败
     */
    private int code;

    /**
     * 返回的数据 具体参考对应方法的返回值
     */
    private List<String> datas;

    private String msg;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public List<String> getDatas() {
        return datas;
    }

    public void setDatas(List<String> datas) {
        this.datas = datas;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.code);
        dest.writeStringList(this.datas);
        dest.writeString(this.msg);
    }

    public ReturnResult() {

    }

    public ReturnResult(int code, List<String> datas) {
        this.code = code;
        this.datas = datas;
    }

    public ReturnResult(int code, String data) {
        this.code = code;
        this.msg = data;
    }

    private ReturnResult(Parcel in) {
        this.code = in.readInt();
        this.datas = in.createStringArrayList();
        this.msg = in.readString();
    }

    public void readFromParcel(Parcel in) {
        this.code = in.readInt();
        this.datas = in.createStringArrayList();
        this.msg = in.readString();
    }

    public static final Creator<ReturnResult> CREATOR = new Creator<ReturnResult>() {
        @Override
        public ReturnResult createFromParcel(Parcel source) {
            return new ReturnResult(source);
        }

        @Override
        public ReturnResult[] newArray(int size) {
            return new ReturnResult[size];
        }
    };
}
